#ifndef STUDENTWIDGET_H
#define STUDENTWIDGET_H

#include <QWidget>
#include<QSqlQuery>
#include<QMouseEvent>
#include<map>
#include"comment.h"
#include"StudentModifyWidget.h"
#include"student.h"
#include"studentsql.h"

namespace Ui {
class StudentWidget;
}

class StudentWidget : public QWidget
{
    Q_OBJECT

public:
    explicit StudentWidget(QWidget *parent = nullptr);
    ~StudentWidget();

    void InitHeadPhoto();

    void InitInfo();

    void InitScore();

    void InitComment();

    void InitStage();

    void SetHeadPhoto(QMouseEvent *e);
    void BackPhotoToSql();

    void mousePressEvent(QMouseEvent *e)override;//鼠标按下
    void mouseMoveEvent(QMouseEvent *e)override;//鼠标悬停

    void mouseMoveEventByHead(QMouseEvent *e);

    void paintEvent(QPaintEvent *e)override;

    void SetStuId(const QString& StuId);

public:
    QString Id();

public slots:
    void ConnectModifyWidget();
    void ConnectComment();
    void ConnectScore();

private:
    Ui::StudentWidget *ui;
    QPixmap headerPhoto;
    QSqlDatabase db;

    StudentModifyWidget StuModifyWidget;
    comment StuCommentWidget;
    Student StuScoreWidget;

    StudentSql MySql;

    QString StuId;

};

#endif // STUDENTWIDGET_H
